//
//  AXFAutoresizeLabelFlowCell.m
//  AXFAutoresizeLabelFlowCell
//
//  Created by ooops on 12/26/16.
//  Copyright © 2016 ya. All rights reserved.
//

#import "AXFAutoresizeLabelFlowCell.h"
#import "AXFAutoresizeLabelFlowConfig.h"
#define JKColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
@interface AXFAutoresizeLabelFlowCell ()

@property (nonatomic,strong) UILabel *titleLabel;

@end

@implementation AXFAutoresizeLabelFlowCell

- (UILabel *)titleLabel {
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.backgroundColor = [AXFAutoresizeLabelFlowConfig shareConfig].itemColor;
        _titleLabel.textColor = [AXFAutoresizeLabelFlowConfig shareConfig].textColor;
        _titleLabel.font = [AXFAutoresizeLabelFlowConfig shareConfig].textFont;
        _titleLabel.layer.cornerRadius = [AXFAutoresizeLabelFlowConfig shareConfig].itemCornerRaius;
        _titleLabel.layer.masksToBounds = YES;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.layer.borderColor = JKColor(220, 220, 220, 1.0).CGColor;
        _titleLabel.layer.borderWidth = 0.5;
    }
    return _titleLabel;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.titleLabel];
    }
    return self;
}

- (void)configCellWithTitle:(NSString *)title {
    self.titleLabel.frame = self.bounds;
    self.titleLabel.text = title;
}

@end
